package com.zxs.service.impl;

import com.zxs.properties.ZxsProperties;
import com.zxs.read.ReadFileInFolder;
import com.zxs.service.IZService;
import com.zxs.util.HttpClient;
import jakarta.annotation.Resource;

import java.io.IOException;

public class IZServiceImpl implements IZService {

    @Resource
    ZxsProperties zxsProperties;
    @Override
    public String pushText(String message) throws IOException {
        return send(message);
    }
    @Override
    public String readFile(String mName) throws IOException {
        return ReadFileInFolder.readContent(zxsProperties.getMpath(),mName);
    }
    @Override
    public String send(String textMsg) throws IOException {
        return HttpClient.postJson(zxsProperties.getWebhook()+"?access_token="+zxsProperties.getToken(),textMsg);
    }
}
